use c++11 noreturn attribute specifier instead of compiler specific attributes. ...
authortsteven4 <tsteven4@users.noreply.github.com>
Sun, 24 Jun 2018 23:38:45 +0000 (17:38 -0600)
committerGitHub <noreply@github.com>
Sun, 24 Jun 2018 23:38:45 +0000 (17:38 -0600)
This should work for all compilers, and certainly helps out MSVC code analysis.

defs.h
fatal.cc

diff --git a/defs.h b/defs.h
index 19ccd301c9c09303658a5567bd644af80d1422ee..de964b2e6e2283b742210dcdca0a8fd7ea89e8ff 100644 (file)
--- a/defs.h
+++ b/defs.h
  */
 #if __GNUC__
 #  define PRINTFLIKE(x,y) __attribute__ ((__format__ (__printf__, (x), (y))))
-#  define NORETURN void __attribute__ ((__noreturn__))
 #else
 #  define PRINTFLIKE(x,y)
-#  define NORETURN void
 #endif
 
 
@@ -863,7 +861,7 @@ typedef struct style_vecs {
 } style_vecs_t;
 extern style_vecs_t style_list[];
 
-NORETURN fatal(const char*, ...) PRINTFLIKE(1, 2);
+[[noreturn]] void fatal(const char*, ...) PRINTFLIKE(1, 2);
 void is_fatal(const int condition, const char*, ...) PRINTFLIKE(2, 3);
 void warning(const char*, ...) PRINTFLIKE(1, 2);
 void debug_print(int level, const char* fmt, ...) PRINTFLIKE(2,3);
index 9ae9702eeb2d1b192eab9a8a1292165c2fde643d..11d5ae3b6b82024c09bf6d9a11e37d5848c7548b 100644 (file)
--- a/fatal.cc
+++ b/fatal.cc
@@ -22,7 +22,7 @@
 #include "defs.h"
 #include <cstdio>
 #include <cstdlib>
-void
+[[noreturn]] void
 fatal(const char* fmt, ...)
 {
   va_list ap;